﻿using LostOrFind.Models;
using Microsoft.EntityFrameworkCore;

namespace LostOrFind.Context;

public partial class MyDbContext : DbContext
{
    public MyDbContext()
    {
    }

    public MyDbContext(DbContextOptions<MyDbContext> options)
        : base(options)
    {
    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
        => optionsBuilder.UseMySql("server=localhost;port=3306;database=lostandfind;user=root;password=suzumiya", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.35-mysql"));

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder
            .UseCollation("utf8mb4_0900_ai_ci")
            .HasCharSet("utf8mb4");

        OnModelCreatingPartial(modelBuilder);
    }

    public DbSet<User> Users
    {
        get;
        set;
    }
    public DbSet<Category> Categories
    {
        get;
        set;
    }
    public DbSet<Location> Locations
    {
        get;
        set;
    }
    public DbSet<Occasion> Occasions
    {
        get;
        set;
    }
    public DbSet<Status> Status
    {
        get;
        set;
    }
    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
